import Vue from 'vue'
import VeeValidate, {Validator} from 'vee-validate'
import zh_CN from 'vee-validate/dist/locale/zh_CN'
Vue.use(VeeValidate, {
    dictionary: {
        zh_CN: zh_CN
    }
})

// 自定义错误提示
const validate = {
    custom: {
        password: {
            required: () => '密码不能为空',
            min: () => '密码为8-20位字母、数字或符合组成',
            max: () => '密码为8-20位字母、数字或符合组成'
        },
        // password: {
        //     required: () => '',
        //     min: () => '',
        //     max: () => ''
        // },
        mobile: {
            required: () => ''
        }
    },
};
Validator.localize('zh_CN', validate)

// 自定义验证规则
Validator.extend('mobile', {
    getMessage: field => '请输入正确的' + field,
    validate: value => {
        return /^((13|14|15|17|18)[0-9]{1}\d{8})$/.test(value)
    }
})



